home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / Hypercard.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  9.6 KB  |  270 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        Hypercard.vu
  5. #
  6. #    Contains:    Quick look test script for Hypercard version 2.1
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.6>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  19. #                                    launchTwitch().
  20. #     <1.0.5>     9/10/93    KTA        Added a couple of waits after selecting 'Save As' to allow
  21. #                                    dialog to appear - failing on slower machines.
  22. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  23. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  24. #
  25. # ****************************************************************************
  26. #
  27.  
  28.  
  29.  
  30. ########################################################################
  31. #                            External libraries 
  32. #=======================================================================
  33. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib","StandardFile.Lib","Print.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  34.  
  35.  
  36. #########################################################################
  37. ########               Application Specific Tasks
  38. #########################################################################
  39.  
  40. #########################################################################
  41. #                        InitAppGlobals()
  42. #========================================================================
  43. # Author:        ML
  44. # Description:    Sets up the tool palettes for Hypercard.  This task
  45. #                must be called first.
  46. # Parameters:    None
  47. # Returns:        Nothing
  48. # Examples:        InitAppGlobals()
  49. #========================================================================
  50. # History:
  51. #
  52. ########################################################################
  53. task InitAppGlobals()
  54. begin
  55.     
  56.     logstr("setting up {global gApptitle}'s globals");            
  57.     global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
  58.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  59.     global kPaintPaletteNum := 1; 
  60.     
  61.     global gPaletteList :=    {
  62.                             {                        #### Start Palette #1 - Paint
  63.                             {159,11,137,20},        # Location of tab palette relative to the window
  64.                             kPopUpPal,                # Palette type
  65.                             {3,6},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  66.                             {20,20},                # Offset between tools {h,v}
  67.                             0,                        # Not used at this time
  68.                             0                        # Not used at this time
  69.                             }                        #### End Palette #1
  70.     };
  71.  
  72.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  73.     global SelectTool :=         { 4,      1,        "Select",        kDrag,    0,                {0}                };
  74.     global LassoTool :=         { 5,      1,        "Lasso",        kDrag,    0,                {0}                };
  75.     global PencilTool :=         { 6,      1,        "Pencil",        kDrag,    0,                {0}                };
  76.     global PaintBrushTool :=     { 7,      1,        "Paint Brush",    kDrag,    0,                {0}                };
  77.     global EraserTool :=         { 8,      1,        "Eraser",        kDrag,    0,                {0}                };
  78.     global LineTool :=             { 9,      1,        "Line",            kDrag,    0,                {0}                };
  79.     global SprayPaintTool :=     { 10,      1,        "Spray Paint",    kDrag,    0,                {0}                };
  80.     global RectangleTool :=     { 11,     1,        "Rectangle",    kDrag,    0,                {0}                };
  81.     global RoundRectTool :=        { 12,      1,        "Round Rect",    kDrag,    0,                {0}                };
  82.     global PaintBucketTool :=    { 13,      1,        "Paint Bucket",    kClick, 0,                {0}                };
  83.     global CircleTool :=         { 14,     1,        "Circle",        kDrag,     0,                {0}                };
  84.     global FreeHandTool :=         { 15,     1,        "FreeHand",        kDrag,    0,                {0}                };
  85.     global TextTool :=             { 16,      1,        "Text",            kClick, 0,                {0}                };
  86.     global HexagonTool :=         { 17,      1,        "Hexagon",        kDrag,    0,                {0}                };
  87.     global PolygonTool :=         { 18,      1,        "Polygon",        kMultiClick, 1,            {0}                };
  88.     
  89.     global PaintToolList:={    SelectTool,
  90.                             LassoTool,
  91.                             PencilTool,
  92.                             PaintBrushTool,
  93.                             EraserTool,
  94.                             LineTool,
  95.                             SprayPaintTool,
  96.                             RectangleTool,
  97.                             RoundRectTool, # don't use PaintBucketTool because blacks out entire window
  98.                             CircleTool,
  99.                             FreeHandTool,
  100.                             TextTool,
  101.                             HexagonTool,
  102.                             PolygonTool
  103.                         };
  104.  
  105.     global gToolList:= PaintToolList;
  106.     global gWindowInset := {1,20,1,1};
  107.     global gBoundingRect:= global gFileName;
  108.     global gDoWindowList := {0,0,1,1}; # Hypercard only supports zoom and drag
  109. end;    #InitAppGlobals
  110.  
  111. #########################################################################
  112. #                            CardTest()
  113. #========================================================================
  114. # Author:        ML
  115. # Description:    Tests the Card functions
  116. # Parameters:    None
  117. # Returns:        Nothing
  118. # Examples:        CardTest();
  119. # Assumptions:    None 
  120. # Applications:    Hypercard
  121. #========================================================================
  122. # History:
  123. #
  124. ########################################################################
  125. task CardTest() 
  126. begin
  127.     LogStr( "Beginning Card Edit Tests");
  128.     CardTestList:= {'New','Delete','Copy','New','Paste'};
  129.     NumCardTests:= card(CardTestList);
  130.     for x:= 1 to NumCardTests
  131.     begin
  132.         CardName:=CardTestList[x];
  133.         CardMenuitem:= "{CardName} Card";
  134.         Selectmenuitem(CardMenuitem, 'Edit');
  135.     end;
  136. end;
  137.  
  138. #########################################################################
  139. #                            GoTest()
  140. #========================================================================
  141. # Author:        ML
  142. # Description:    Tests the Go functions
  143. # Parameters:    None
  144. # Returns:        Nothing
  145. # Examples:        GoTest();
  146. # Assumptions:    None 
  147. # Applications:    Hypercard
  148. #========================================================================
  149. # History:
  150. #
  151. ########################################################################
  152. task GoTest() 
  153. begin
  154.     LogStr( "Beginning Card navigation tests");
  155.     GoTestList:= {'First','Next','Prev','Last','Back','Home','Back'};
  156.     NumGoTests:= card(GoTestList);
  157.     for x:= 1 to NumGoTests
  158.     begin
  159.         Selectmenuitem(GoTestList[x], 'Go');
  160.     end;
  161. end;
  162.  
  163. #########################################################################
  164. #                            PaintTest()
  165. #========================================================================
  166. # Author:        ML
  167. # Description:    Tests the Paint functions
  168. # Parameters:    None
  169. # Returns:        Nothing
  170. # Examples:        PaintTest();
  171. # Assumptions:    None 
  172. # Applications:    Hypercard
  173. #========================================================================
  174. # History:
  175. #
  176. ########################################################################
  177. task PaintTest() 
  178. begin
  179.     LogStr( "Beginning Paint tests");
  180.     PaintTestList:= {'Select All','Invert','Darken','Lighten','Trace Edges',
  181.                     'Rotate left','Rotate Right','Flip Vertical',
  182.                     'Flip Horizontal','Opaque','Transparent'};
  183.     NumPaintTests:= card(PaintTestList);
  184.     for x:= 1 to NumPaintTests
  185.     begin
  186.         Selectmenuitem(PaintTestList[x], 'Paint');
  187.     end;
  188. end;
  189.  
  190. #########################################################################
  191. #                            views()
  192. #========================================================================
  193. # Author:        ML
  194. # Description:    Change views.
  195. # Parameters:    None
  196. # Returns:        Nothing
  197. # Examples:        views();
  198. # Assumptions:    None 
  199. # Applications:    Hypercard
  200. #========================================================================
  201. # History:
  202. #
  203. ########################################################################
  204. task views() begin
  205.     LogStr( "Changing Views");
  206.     Selectmenuitem('Select', 'Paint');
  207.     selectmenuitem('Fatbits','Options');
  208.     selectmenuitem('Fatbits','Options');
  209. end; # views()
  210.  
  211. ################################################################################
  212. ####################             Main script                    ####################
  213. ################################################################################
  214. script Hypercard (ScriptLevel:= -1)
  215. begin
  216.     InitGlobals(ScriptLevel);
  217.     InitDraw();
  218.     InitFonts();
  219.     global gAppTitle := 'Hypercard';
  220.     global gAppVersion := '2.1';    # version of app you will be running
  221.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    #This is used in SaveAs when saving files
  222.     SuiteStart('Hypercard.vu');                    # begin a new test suite
  223.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  224.     begin
  225.         InitAppGlobals();                            # setup Hypercard's globals
  226.         (*
  227.         *)
  228.         DoSetUpApp('Cancel',-1,0,,,,0);                # select cancel if launched w/o home stack
  229.         
  230.         SelectMenuItem("Preferences", "Home");
  231.         MoveRelativetoWindow(88,228,'Home',2);
  232.         logstr('Selected the Painting User Level');
  233.         
  234.         SelectMenuItem("New Stack", "File");        # Create a New stack
  235.         SaveAs(gFileName);                            # save/replace
  236.         
  237.         Scrapbook(global kScrapPict);                # Paste PICT from Scrapbook
  238.         Scrapbook(global kScrapText);                # Paste TEXT from Scrapbook
  239.         
  240.         selectMenuItem("Save A Copy", "File");        # Select Save A Copy from the File menu
  241.         wait(3);
  242.         SelectButton('Cancel');                        # Cancel the Standard SF_Put Dialog
  243.         selectMenuItem("Save A Copy", "File");        # Select Save A Copy from the File menu
  244.         wait(3);
  245.         SaveAs(gFileName,0);                        # test SF_Put
  246.         
  247.         CardTest();                                    # Test Card functions
  248.         
  249.         GoTest();                                    # Test card navigation
  250.         
  251.         PageSetup();                                # Page Setup Testing
  252.         
  253.         Scrapbook(global kScrapPICT);                # Paste PICT from Scrapbook
  254.         
  255.         DoDraw(,gFileName);                            # test Paint tools
  256.         
  257.         PaintTest();                                # test Paint functions
  258.                 
  259.         Views();                                    # Change views
  260.             
  261.         DoCloseApp(-1, -1, 0);                        # Don't do Save As, about box, or page setup
  262.         
  263.         LogStr("############################# LIMITATIONS: ############################");
  264.         logstr("NOTE: Do to unique nature of Hypercard, many standard QL tests can't be done.  
  265.         DoWindows not done because no title bars on compact Macs");
  266.         
  267.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  268.     SuiteEnd();
  269. end; # script Hypercard
  270.